import ch.hsr.geohash.GeoHash;
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.hive.ql.exec.Description;
@Description(
        name = "convert_geohash",
        value = "_FUNC_(latitude, longitude, precision) - returns a geohash code"
)
public class geohash extends UDF {

    public String evaluate(double latitude,double longitude,int precision){
        GeoHash geoHash = GeoHash.withCharacterPrecision(latitude, longitude, precision);
        return geoHash.toBase32();
    }
}


